import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);
export default new Vuex.Store({
  strict: process.env.NODE_ENV !== 'production',
  state: {
    loginShow: false,
    isLogin: 0,
    // 用户信息
    user: {},
    // 用户基本信息
    userInfo: {},
    //消息中心提示
    isMessage: false,
    //首页导航位置
    isNavIndex: "/",
    columnId: "",
    //设置视频还是音频
    videotype: "",
    //二级id
    columnTwoId:"",
     //三级id
    columnThreeId:"",
    // 视听分类id
    Audiovisual: "",
    // 图书内容设置
    options: {
      bgColor: "#ECECEC",
      fontSize: 16,
      fontFamily: "Microsoft Yahei, Heiti SC, Heiti TC",
      lineHeight: 2,
      color: "#000"
    }
  },
  mutations: {
    //设置登录显示状态
    SET_LOGINSHOW(state, msg) {
      state.loginShow = msg
    },
    //设置登录信息
    SET_USER(state, msg) {
      state.user = msg
    },
    //设置用户基本信息
    SET_USERINFO(state, msg) {
      state.userInfo = msg
    },
    //是否登录
    SET_LOGINTOKEN(state, msg) {
      state.isLogin = msg
    },
    //消息中心提示
    SET_ISMESSAGE(state, msg) {
      state.isMessage = msg
    },
    //设置首页导航位置
    SET_ISNAVINDEX(state, index) {
      state.isNavIndex = index
    },
    //根据分类columnId显示列表
    SET_COLUMNID(state, msg) {
      state.columnId = msg
    },
    //记录图书二级分类
    SET_COLUMNTWOID(state,msg){
        state.columnTwoId = msg
    },
    //记录图书三级分类
    SET_COLUMNTHREEID(state,msg){
        state.columnThreeId = msg
    },
    //设置视频还是音频
    SET_VIDEOTYPE(state, msg) {
      state.videotype = msg
    },
    //设置图书内容设置
    SET_OPTIONS(state, msg) {
      state.options = msg
    }
  },
  modules: {

  },
  getters: {

  },
  actions: {
      resetVuex({commit}){
        commit("SET_LOGINSHOW", false)
        commit("SET_USER", {})
        commit("SET_USERINFO", {})
        commit("SET_LOGINTOKEN", 0)
        commit("SET_ISMESSAGE", false)
        commit("SET_ISNAVINDEX", '/')
        commit("SET_COLUMNID", '')
        commit("SET_COLUMNTWOID", '')
        commit("SET_COLUMNTHREEID", '')
        commit("SET_VIDEOORMUSIC", '')
        commit("SET_OPTIONS", {
          bgColor: "#ECECEC",
          fontSize: 16,
          fontFamily: "Microsoft Yahei, Heiti SC, Heiti TC",
          lineHeight: 2,
          color: "#000"
        })
      }
  },
});
